<template>
    <div>
      <div class="table-default">
        <el-table :data="tableData" class="mt-3" v-loading="loading" row-key="id" default-expand-all :tree-props="{ children: 'children' }">
          <el-table-column prop="excel_id" label="ID" />
          <el-table-column prop="name" label="文件名" />
          <el-table-column prop="status" label="状态" >
              <template #default="scope">
                  <span v-if="scope.row.status == '0'">导出中</span>
                  <span v-if="scope.row.status == '1'">完成</span>
                  <span v-if="scope.row.status == '2'">失败</span>
              </template>
          </el-table-column>
          <!-- <el-table-column prop="type" label="类型" /> -->
          <el-table-column prop="admin.username" label="导出管理员" />
          <el-table-column prop="message" label="提示" />
          <el-table-column prop="created_at" label="下载时间" />
          <el-table-column label="操作" width="200">
            <template #default="scope">
              <a :href="baseURL + '' + scope.row.path" v-if="scope.row.status == 1">下载</a>
            </template>
          </el-table-column>
        </el-table>
        <Paginate />
      </div>
    </div>
  </template>

  <script lang="ts" setup>
  // @ts-nocheck
  import { computed, onMounted } from 'vue'
  import { useGetList } from '@/composables/curd/useGetList'
  import { env } from '@/support/helper'

  const baseURL = env('VITE_BASE_URL_NAME')
  const api = 'excel'
  const { data, query, search, reset, loading } = useGetList(api, false)
  const tableData = computed(() => data.value?.data)



  onMounted(() => {
    search()
  })
  </script>
